package com.base.vistter.iframe.security.handler;

import com.base.vistter.iframe.menu.ErrorLoginEnum;
import com.base.vistter.iframe.utils.IoUtils;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.AuthenticationFailureHandler;

import java.io.IOException;

public class IframeAuthenticationFailureHandler implements AuthenticationFailureHandler {

    @Override
    public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException{
        IoUtils.errorWrite(ErrorLoginEnum.USERNAME_OR_PASSPWRD_ERROR, response);
    }

}
